package com.diaohaiwen.framework.db.spi;

import com.diaohaiwen.common.enums.LogTypeEnum;
import com.diaohaiwen.common.obj.log.BaseLog;
import com.diaohaiwen.common.obj.log.DbLog;
import com.diaohaiwen.common.obj.log.LogbackLog;
import com.diaohaiwen.common.obj.log.RequestLog;
import com.diaohaiwen.common.log.BaseLogSend;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author 刁海文
 * @since 2023/7/2 20:27
 * @Remark
 */
@Slf4j(topic = "DB Log Send")
@Service
public class DBLogSend extends BaseLogSend {


    @Override
    public void executeHTTP(RequestLog log) {
        DBLogSend.log.info(log.toString());
    }

    @Override
    public void executeDB(DbLog log) {
        DBLogSend.log.info(log.toString());

    }

    @Override
    public <T> void executeLogback(LogbackLog log) {
        DBLogSend.log.info(log.toString());
    }

    @Override
    public <T> void executeAPP(BaseLog<T> log) {
        DBLogSend.log.info(log.toString());
    }

    @Override
    public <T> void executeMQ(BaseLog<T> log) {
        DBLogSend.log.info(log.toString());
    }

    @Override
    public LogTypeEnum logClassType() {
        return LogTypeEnum.DB;
    }
}
